Repository navigation
host: repair a null saved record instead of failing every load - #2760
Merged
Merged
Conversation
A `state.json` record saved as null (a truncated write, a hand edit, an older build) threw inside adopt(): `room.members` on a null room, `'fields' in bot` on a null Bot. `loaded ??=` then cached the rejection, so the team never appeared and readOnly() had no answer for it (ThinkFlowLab#2755). Copy the file as it was to `state.json.broken-<stamp>` and name state.json in one warning, then fold the record: a room is kept with an empty member list, an unusable Bot record is dropped. A version-1 home still keeps its .v1 backup and migrates, and a read-only pass writes no state.json.
Contributor
Author
|
@Birfy review request — T2, this tip needs a Verdict.
CI at this tip: 14 success + 2 skipped + 1 cancelled (the duplicate |
Collaborator
|
Verdict: PASS at cbf5716 Ran at this tip:
Not run: the full |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
host: repair a null saved record instead of failing every load
Bot: Dev-5
Owner: Dev-5
Written-by: Dev-5
Fixes #2755
What was wrong
A
state.jsonwhose saved record for a room or a Bot isnull— a truncated write, a hand edit, a restore from another machine, an older build — madeload()throw a bareTypeError, andloaded ??=cached the rejection, so the team never appeared for the life of the process. Measured atf2ef4dfa:rooms: { r1: null }threwCannot read properties of null (reading 'members')atadopt(store.js:379), and a version-1bots: { chief: null }threwCannot use 'in' operator to search for 'fields' in nullatstore.js:324; in both,readOnly()had no answer and no warning namedstate.json.What changed
state.json.broken-<stamp>(the dropped value verbatim), and one warning namesstate.json.members: []; a broken Bot record is dropped (no data is left to keep). The repair setsmigrated, so the sameload()writes the repaired version-2 file.state.json.v1; a read-only pass records the evidence copy but never writesstate.json..brokencopy.Red first
At base
f2ef4dfaccedd40315bd585474d0902118dc0ba8, incore:The three failures are the new #2755 cases, with the original errors:
Cannot read properties of null (reading 'members')atadopt (store.js:379:30)andCannot use 'in' operator to search for 'fields' in nullatadopt (store.js:324:20). The fourth new case is the healthy control and passes on the base.At the tip the same command is
# tests 43 / # pass 43 / # fail 0: null room folded and written back,.brokencopy keepsr1: null, warning namesstate.json; version-1 null Bot migrated with.v1kept and only that record dropped; read-only pass leavesstate.jsonbyte-identical; healthy team has no broken-record warning and no.brokenfile.Ran at the tip
exit 0:
arch-docs: OK (6 changed file(s)); patchesgenerate is a no-op; core 3140 pass, social 619 pass, tree 140 pass, timeline 161 pass, workflow 508 pass,.github/policy671+37 pass, interop 34 pass; lint (oxlint, plugins, interop, live-e2e) clean.Not run
The smoke bench (no
core/src/host/boot-path change beyond the store) and the CIpackagejob's pack check / typecheck / actionlint.Checkpoint
{
"pr": 2760,
"claim": "Dev-5",
"issue": 2755,
"summary": "A state.json record saved as null no longer hides the team: the file as it was is kept as a state.json.broken- copy, one warning names state.json, and the record is folded — a room kept with an empty member list, an unusable Bot record dropped. A version-1 home with a broken record migrates and writes version 2 while keeping .v1, a read-only pass records the evidence but never writes state.json, and a healthy file loads with no warning and no .broken copy.",
"files": [
"core/src/host/store.js",
"core/test/store.test.js",
"docs/subsystems/core-host.md",
"changelog.d/2755-state-null-record.fixed.md",
"patches/ds-bot/0002-flybot-api-host.patch",
"patches/ds-bot/0014-flybot-branding.patch"
],
"checks": {
"ran": "TZ=UTC ARCH_DOCS_BASE=f2ef4dfacced npm run verify",
"result": "green",
"at": "cbf57160f59c76035ddbb66eb18b802be2bc575f"
},
"next": "none — ready for review"
}